<?php
  
  include_once "Proxy.php";
  
  class YouTubeVids extends Proxy {
    private $url = 'http://gdata.youtube.com/feeds/videos?max-results=20&vq=';
    private $result;
    
    public function YouTubeVids() { parent::Proxy(); }    
    
    public function search($artist=0, $songtitle=0) {
      
      curl_setopt($this->curl, CURLOPT_URL, $this->url."$artist+$songtitle");
      $this->result = curl_exec($this->curl);
 
      if(($status = curl_getinfo($this->curl, CURLINFO_HTTP_CODE)) != 200){
        $this->result = false;
        throw new MTException('Error while connecting to YouTube', $status);
      }            
    }

   public function sendResult() {
    Proxy::send($this->result);
   }

  }
